package com.tjw.ec.upms.api.feign.factory;

import com.tjw.ec.upms.api.feign.RemoteActionService;
import com.tjw.ec.upms.api.feign.fallback.RemoteActionServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * 远程调用异常工厂 : 系统中所有操作的动作表;
 *
 * @author T-junwen
 * @email t-junwen@foxmail.com
 * @date 2019-07-27 16:54:21
 */
@Slf4j
@Component
public class RemoteActionServiceFallbackFactory implements FallbackFactory<RemoteActionService> {

    @Override
    public RemoteActionService create(Throwable throwable) {
        RemoteActionServiceFallbackImpl remoteActionServiceFallback = new RemoteActionServiceFallbackImpl();
        remoteActionServiceFallback.setCause(throwable);
        return remoteActionServiceFallback;
    }
}

